<template>
  <div id="app">
    <!-- <div
      class="test"
    >测试环境</div>-->
    <transition name="router-fade" mode="out-in">
      <router-view v-if="isRouterAlive"></router-view>
    </transition>
  </div>
</template>
<script>
// import { baseURL } from './components/Request';
export default {
  name: 'App',
  provide() {
    return {
      reload: this.reload
    };
  },
  data() {
    return {
      isRouterAlive: true
    };
  },
  mounted() {
    // var unuse = window.location.href.split('#/')[1].split('?')[0];
    // console.log(unuse);
    // if (unuse !== 'wxcitizenCard' && unuse !== 'citizenCard') {
    //   this.$http.post('/tuser/userInfo', {}).then(res => {
    //     console.log(res);
    //     if (!res.data.object.openIdYouchu) {
    //       window.location.replace(
    //         'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxce37d1610dd01b2a&redirect_uri=http%3a%2f%2fopen.580travel.com%2fredirectUrl&response_type=code&state=' +
    //           encodeURI(baseURL) +
    //           '%2fwx%2fyouchu%2ftoLogin&scope=snsapi_userinfo&component_appid=wxffe4479df45e91b7#wechat_redirect'
    //       );
    //     }
    //   });
    // }
  },
  methods: {
    reload() {
      this.isRouterAlive = false;
      this.$nextTick(function() {
        this.isRouterAlive = true;
      });
    }
  }
};
</script>
<style>
body {
  font-size: 16px;
  background-color: #f5f5f5;
  -webkit-font-smoothing: antialiased;
}
.router-fade-enter-active,
.router-fade-leave-active {
  transition: opacity 0.3s;
}
.router-fade-enter,
.router-fade-leave-active {
  opacity: 0;
}
img {
  max-width: 100% !important;
}
.test {
  background-color: #15beff;
  color: #fff;
  position: fixed;
  width: 100%;
  text-align: center;
  padding: 10px;
  z-index: 9;
}
</style>
